<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>检查</title>
</head>
<body>
<?php
  $user = $_POST['user'];
  $password = $_POST['password'];
  include_once("conn.php");
  $sql = "select * from users where username='".$user."' and password='".$password."'";
  $result = mysqli_query($conn,$sql);
  $num = mysqli_num_rows($result);
  if($num==1){
    $_SESSION['user'] = $user;
    $_SESSION['login'] = 'd';
    echo '<script>alert("登陆成功");window.location.href="list.php";</script>';
  }else{
    echo '<script>alert("用户或密码错误");history.go(-1);</script>';
  }
  /* echo '你输入的信息如下<br/>';
  echo '用户名:'.$_GET["user"].'<br/>';
  echo '密码:'.$_REQUEST["password"]; */
?>
</body>
</html>

